FHIR © HL7.org  |  Server Home  |  FHIR Server FHIR Server 3.4.11  |  FHIR Version n/a  User: [n/a]

Resource StructureMap/FHIR Server from package who.ddcc#current (125 ms)

Package who.ddcc
Type StructureMap
Id Id
FHIR Version R4
Source http://smart.who.int/ddcc/https://build.fhir.org/ig/WorldHealthOrganization/ddcc/StructureMap-DIVOCtoDDCC.html
Url http://smart.who.int/ddcc/StructureMap/CertDIVOCtoDDCC
Version 1.0.0
Status draft
Date 2024-10-17T05:03:04+00:00
Name DIVOCtoDDCC
Experimental False
Realm uv
Authority who

Resources that use this resource

No resources found


Resources that this resource uses

No resources found



Narrative

Note: links and images are rebased to the (stated) source

Generated Narrative: StructureMap DIVOCtoDDCC

map "http://smart.who.int/ddcc/StructureMap/CertDIVOCtoDDCC" = "DIVOCtoDDCC"

uses "http://smart.who.int/ddcc/StructureDefinition/CertDIVOC" alias W3CVC as source
uses "http://hl7.org/fhir/ig/divoc/StructureDefinition/CredentialSubject" alias CredentialSubject as source
uses "http://hl7.org/fhir/ig/divoc/StructureDefinition/Proof" alias Proof as source
uses "http://hl7.org/fhir/ig/divoc/StructureDefinition/Address" alias Address as source
uses "http://hl7.org/fhir/ig/divoc/StructureDefinition/Evidence" alias Evidence as source
uses "http://hl7.org/fhir/ig/divoc/StructureDefinition/Verifier" alias Verifier as source
uses "http://hl7.org/fhir/ig/divoc/StructureDefinition/Facility" alias Facility as source
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target

group DIVOCtoDDCC(source src : W3CVC, target bundle : Bundle) {
  src -> bundle.type = 'transaction' "set bundle type";
  src ->  bundle,  bundle.entry as entry,  entry.resource = create('Composition') as comp then {
    src -> bundle then ExtractCert(src, bundle, comp) "Certificate";
    src -> bundle then ExtractComposition(src, comp) "Composition";
  } "Patient and Composition Create";
}

group ExtractCert(source src : W3CVC, target bundle : Bundle, target comp : Composition) {
  src ->  comp,  bundle.entry as entry,  entry.resource = create('Patient') as patient,  uuid() as pid then {
    src -> patient then ExtractPatient(src, pid, patient) "extract patient";
    src ->  comp.subject as subj,  subj.reference = append('Patient/', pid) "Set patient";
    src where (src.evidence.count() > 0) -> comp.section as section then {
      src ->  section.code as code,  code.coding as coding,  coding.system = 'http://loinc.org',  coding.code = '11369-6',  coding.display = 'History of Immunization Narrative' "add section";
      src.evidence as ev ->  comp,  bundle.entry as entryImm,  entryImm.resource = create('Immunization') as immunization,  uuid() as iid,  bundle.entry as entryOrg,  entryOrg.resource = create('Organization') as org,  uuid() as oid,  bundle.entry as entryManuf,  entryOrg.resource = create('Organization') as manuf,  uuid() as mid then {
        src -> immunization.id = iid "Immunization ID";
        src -> org.id = oid "Organization ID";
        src -> manuf.id = mid "Organization ID";
        src ->  section.entry as entry,  entry.reference = append('Immunization/', iid),  section.author as author,  author.reference = append('Organization/', oid) "add entry/author to section";
        src ->  comp.author as author,  author.reference = append('Organization/', oid) "Set org";
        src ->  immunization.patient as subj,  subj.reference = append('Patient/', pid) "Set patient";
        ev.facility as facility then {
          facility.name as name -> org.name = name "Set Organization name";
        };
        ev.manufacturer as manufName -> manuf.name = manufName "Set Manufacturer name";
        ev.verifier as practitioner then {
          practitioner.name as practName ->  bundle.entry as entry,  entry.resource = create('Practitioner') as practitioner,  practitioner.id = uuid() as pracid,  practitioner.name = create('HumanName') as humanName,  humanName.text = practName,  immunization.performer as performer,  performer.actor as actor,  actor.reference = append('Practitioner/', pracid) "set pract name";
        } "create practitioner";
        src -> bundle then ExtractVaccine(ev, oid, mid, immunization, bundle) "extract vaccine info";
      } "Immunization Create";
    } "Vaccination List";
  } "Patient Create";
}

group ExtractVaccine(source ev : Evidence, source oid, source mid, target immunization : Immunization, target bundle : Bundle) {
  ev.date as dt -> immunization.occurrence = dt "set occurrence date";
  ev.batch as lot -> immunization.lotNumber = lot "set lot number";
  ev.icd11Code as icd11Code then {
    ev.prophylaxis as prophylaxis ->  immunization.vaccineCode as type,  type.coding as coding,  coding.system = 'http://hl7.org/fhir/sid/icd-11',  coding.code = icd11Code,  coding.display = prophylaxis "set vaccine coding";
  } "Parse ICD11Code and Prophylaxis";
  ev.certificateId as ci ->  immunization.identifier as identif,  identif.value = ci "set identifier ci";
  ev.vaccine as mp ->  immunization.extension as ext,  ext.value = create('Coding') as coding,  ext.url = 'https://smart.who.int/ddcc/StructureDefinition/DDCCVaccineBrand',  coding.display = mp "set brand";
  ev.facility as facility then {
    facility.address as address then {
      address.addressCountry as contry ->  immunization.extension as ext,  ext.value = create('Coding') as coding,  ext.url = 'https://smart.who.int/ddcc/StructureDefinition/DDCCCountryOfVaccination',  coding.code = contry,  coding.system = 'urn:iso:std:iso:3166' "set country";
    };
  } "facility rule";
  ev.effectiveUntil as validFrom ->  immunization.extension as ext,  ext.value = validFrom,  ext.url = 'https://smart.who.int/ddcc/StructureDefinition/DDCCVaccineValidFrom' "effectiveUntil rule";
  oid ->  immunization.manufacturer as manuf,  manuf.reference = append('Organization/', oid) "set manuf";
  ev.facility as w3cFacility ->  bundle.entry as entry,  entry.resource = create('Location') as location,  location.id = uuid() as locid,  immunization.location as loc,  loc.reference = append('Location/', locid) then ExtractLocation(w3cFacility, location) "Extracting Immunization Location";
  ev -> immunization.protocolApplied as protocolApplied then ExtractProtocolApplied(ev, oid, protocolApplied) "set protocol applied";
}

group ExtractProtocolApplied(source ev : Evidence, source oid, target protocol : ProtocolApplied) {
  ev.dose as dn -> protocol.doseNumber = dn "set dose number";
  ev.totalDoses as sd -> protocol.seriesDoses = sd "set series doses";
  ev ->  protocol.targetDisease as codeable,  codeable.coding as coding,  coding.system = 'http://snomed.info/sct',  coding.code = '840539006' "set target disease type";
  ev ->  protocol.authority as authority,  authority.reference = append('Organization/', oid) "set authority";
}

group ExtractPatient(source src : W3CVC, source pid, target patient : Patient) {
  pid -> patient.id = pid "Patient ID";
  src.credentialSubject as credentialSubject -> patient then ExtractPatientFromSubj(credentialSubject, patient) "Patient Data from Subj";
  src.credentialSubject as credSubj then {
    src.issuanceDate as issuanceDate then {
      credSubj.age as age -> patient.birthDate = evaluate(issuanceDate, (($this - age).toString().substring(0, 4))) "set age";
    } "set age issuance date";
  } "set cred age";
}

group ExtractPatientFromSubj(source src : CredentialSubject, target patient : Patient) {
  src.name as patientName ->  patient.name = create('HumanName') as humanName,  humanName.text = patientName "Patient Name";
  src.id as id ->  patient.identifier as identif,  identif.value = id "set patient identifier";
  src.dob as birthDate -> patient.birthDate = birthDate "set birthDate";
  src.gender as gender -> patient then ExtractGender(gender, patient) "Extract Gender";
  src.sex as sex -> patient then ExtractGender(sex, patient) "Extract Sex";
  src.address as w3cAddress -> patient.address as fhirAddress then ExtractAddress(w3cAddress, fhirAddress) "Extracting Patient Address";
}

group ExtractLocation(source facility : Facility, target location : Address) {
  facility.name as name -> location.name = name "facility name";
  facility.address as w3cAddress -> location.address as fhirAddress then ExtractAddress(w3cAddress, fhirAddress) "facility address";
}

group ExtractAddress(source w3cAddress : Address, target fhirAddress : Address) {
  w3cAddress.streetAddress as line1 -> fhirAddress.line = line1 "Line 1";
  w3cAddress.streetAddress2 as line2 -> fhirAddress.line = line2 "Line 2";
  w3cAddress.city as city -> fhirAddress.city = city "City";
  w3cAddress.district as district -> fhirAddress.district = district "District";
  w3cAddress.postalCode as postal -> fhirAddress.postalCode = postal "Postal";
  w3cAddress.addressRegion as region -> fhirAddress.state = region "Region";
  w3cAddress.addressCountry as country -> fhirAddress.country = country "Country";
}

group ExtractGender(source gender, target patient : Patient) {
  gender where (gender = 'M') -> patient.gender = 'male' "set male";
  gender where (gender = 'F') -> patient.gender = 'female' "set female";
  gender where (gender = 'Male') -> patient.gender = 'male' "set male";
  gender where (gender = 'Female') -> patient.gender = 'female' "set female";
}

group ExtractComposition(source src : W3CVC, target composition : Composition) {
  src -> composition.title = 'International Certificate of Vaccination or Prophylaxis' "Title";
  src ->  composition.category as category,  category.coding as coding then {
    src -> coding.code = 'ddcc-vs' "Category";
  } "set category";
  src ->  composition.type as type,  type.coding as coding then {
    src ->  coding.system = 'http://loinc.org',  coding.code = '82593-5',  coding.display = 'Immunization summary report' "set type coding";
  } "set type";
  src ->  composition.event as event,  event.period = create('Period') as period then ExtractPeriod(src, period) "Extract Period";
  src.credentialSubject as credentialSubject -> composition then {
    credentialSubject.refId as refId ->  composition.identifier as identif,  identif.value = refId "set comp identifier";
  } "set comp identifier parent";
}

group ExtractPeriod(source src : W3CVC, target tgt : Period) {
  src.issuanceDate as issuanceDate -> tgt.start = issuanceDate "Start issuedAt";
}


Source

{
  "resourceType" : "StructureMap",
  "id" : "DIVOCtoDDCC",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap DIVOCtoDDCC</b></p><a name=\"DIVOCtoDDCC\"> </a><a name=\"hcDIVOCtoDDCC\"> </a><a name=\"DIVOCtoDDCC-en-US\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>http://smart.who.int/ddcc/StructureMap/CertDIVOCtoDDCC<span style=\"color: navy\">&quot; = &quot;</span>DIVOCtoDDCC<span style=\"color: navy\">&quot;\r\n\r\n</span><b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureDefinition-CertDIVOC.html\" title=\"Certificate - DIVOC Verifiable Credential Logical Model\">http://smart.who.int/ddcc/StructureDefinition/CertDIVOC</a><span style=\"color: navy\">&quot; </span><b>alias </b>W3CVC <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>http://hl7.org/fhir/ig/divoc/StructureDefinition/CredentialSubject<span style=\"color: navy\">&quot; </span><b>alias </b>CredentialSubject <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>http://hl7.org/fhir/ig/divoc/StructureDefinition/Proof<span style=\"color: navy\">&quot; </span><b>alias </b>Proof <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>http://hl7.org/fhir/ig/divoc/StructureDefinition/Address<span style=\"color: navy\">&quot; </span><b>alias </b>Address <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>http://hl7.org/fhir/ig/divoc/StructureDefinition/Evidence<span style=\"color: navy\">&quot; </span><b>alias </b>Evidence <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>http://hl7.org/fhir/ig/divoc/StructureDefinition/Verifier<span style=\"color: navy\">&quot; </span><b>alias </b>Verifier <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span>http://hl7.org/fhir/ig/divoc/StructureDefinition/Facility<span style=\"color: navy\">&quot; </span><b>alias </b>Facility <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">&quot; </span><b>alias </b>Bundle <b>as </b><b>target</b>\r\n\r\n<b>group </b>DIVOCtoDDCC<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>W3CVC, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -&gt; </b></span>bundle.type = <span style=\"color: blue\">'transaction'</span> <i>&quot;set bundle type&quot;</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -&gt; </b></span> bundle<span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">entry</span><span style=\"color: navy\">, </span> entry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Composition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">comp</span><b> then</b><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>ExtractCert<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">comp</span><span style=\"color: navy\">)</span> <i>&quot;Certificate&quot;</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>ExtractComposition<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">comp</span><span style=\"color: navy\">)</span> <i>&quot;Composition&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;Patient and Composition Create&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtractCert<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>W3CVC, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">comp</span><span style=\"color: navy\"> : </span>Composition<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -&gt; </b></span> comp<span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">entry</span><span style=\"color: navy\">, </span> entry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span> <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">pid</span><b> then</b><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -&gt; </b></span>patient<b> then </b>ExtractPatient<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">pid</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">)</span> <i>&quot;extract patient&quot;</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -&gt; </b></span> comp.subject<b> as </b><span style=\"color: maroon\">subj</span><span style=\"color: navy\">, </span> subj.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">pid</span><span style=\"color: navy\">)</span> <i>&quot;Set patient&quot;</i><span style=\"color: navy\">;</span>\r\n src<b> where </b>(src.evidence.count() &gt; 0)<span style=\"color: navy\"><b> -&gt; </b></span>comp.section<b> as </b><span style=\"color: maroon\">section</span><b> then</b><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -&gt; </b></span> section.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'11369-6'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'History of Immunization Narrative'</span> <i>&quot;add section&quot;</i><span style=\"color: navy\">;</span>\r\n src.evidence<b> as </b><span style=\"color: maroon\">ev</span><span style=\"color: navy\"><b> -&gt; </b></span> comp<span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">entryImm</span><span style=\"color: navy\">, </span> entryImm.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Immunization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">immunization</span><span style=\"color: navy\">, </span> <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">iid</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">entryOrg</span><span style=\"color: navy\">, </span> entryOrg.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">org</span><span style=\"color: navy\">, </span> <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">oid</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">entryManuf</span><span style=\"color: navy\">, </span> entryOrg.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">manuf</span><span style=\"color: navy\">, </span> <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">mid</span><b> then</b><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -&gt; </b></span>immunization.id = <span style=\"color: maroon\">iid</span> <i>&quot;Immunization ID&quot;</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -&gt; </b></span>org.id = <span style=\"color: maroon\">oid</span> <i>&quot;Organization ID&quot;</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -&gt; </b></span>manuf.id = <span style=\"color: maroon\">mid</span> <i>&quot;Organization ID&quot;</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -&gt; </b></span> section.entry<b> as </b><span style=\"color: maroon\">entry</span><span style=\"color: navy\">, </span> entry.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Immunization/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">iid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> section.author<b> as </b><span style=\"color: maroon\">author</span><span style=\"color: navy\">, </span> author.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">oid</span><span style=\"color: navy\">)</span> <i>&quot;add entry/author to section&quot;</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -&gt; </b></span> comp.author<b> as </b><span style=\"color: maroon\">author</span><span style=\"color: navy\">, </span> author.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">oid</span><span style=\"color: navy\">)</span> <i>&quot;Set org&quot;</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -&gt; </b></span> immunization.patient<b> as </b><span style=\"color: maroon\">subj</span><span style=\"color: navy\">, </span> subj.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">pid</span><span style=\"color: navy\">)</span> <i>&quot;Set patient&quot;</i><span style=\"color: navy\">;</span>\r\n ev.facility<b> as </b><span style=\"color: maroon\">facility</span><b> then</b><span style=\"color: navy\"> {\r\n</span> facility.name<b> as </b><span style=\"color: maroon\">name</span><span style=\"color: navy\"><b> -&gt; </b></span>org.name = <span style=\"color: maroon\">name</span> <i>&quot;Set Organization name&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n ev.manufacturer<b> as </b><span style=\"color: maroon\">manufName</span><span style=\"color: navy\"><b> -&gt; </b></span>manuf.name = <span style=\"color: maroon\">manufName</span> <i>&quot;Set Manufacturer name&quot;</i><span style=\"color: navy\">;</span>\r\n ev.verifier<b> as </b><span style=\"color: maroon\">practitioner</span><b> then</b><span style=\"color: navy\"> {\r\n</span> practitioner.name<b> as </b><span style=\"color: maroon\">practName</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">entry</span><span style=\"color: navy\">, </span> entry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span> practitioner.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">pracid</span><span style=\"color: navy\">, </span> practitioner.name = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'HumanName'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">humanName</span><span style=\"color: navy\">, </span> humanName.text = <span style=\"color: maroon\">practName</span><span style=\"color: navy\">, </span> immunization.performer<b> as </b><span style=\"color: maroon\">performer</span><span style=\"color: navy\">, </span> performer.actor<b> as </b><span style=\"color: maroon\">actor</span><span style=\"color: navy\">, </span> actor.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">pracid</span><span style=\"color: navy\">)</span> <i>&quot;set pract name&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;create practitioner&quot;</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>ExtractVaccine<span style=\"color: navy\">(</span><span style=\"color: maroon\">ev</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">oid</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">mid</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">immunization</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>&quot;extract vaccine info&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;Immunization Create&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;Vaccination List&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;Patient Create&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtractVaccine<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">ev</span><span style=\"color: navy\"> : </span>Evidence, <b>source</b> <span style=\"color: maroon\">oid</span>, <b>source</b> <span style=\"color: maroon\">mid</span>, <b>target</b> <span style=\"color: maroon\">immunization</span><span style=\"color: navy\"> : </span>Immunization, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> ev.date<b> as </b><span style=\"color: maroon\">dt</span><span style=\"color: navy\"><b> -&gt; </b></span>immunization.occurrence = <span style=\"color: maroon\">dt</span> <i>&quot;set occurrence date&quot;</i><span style=\"color: navy\">;</span>\r\n ev.batch<b> as </b><span style=\"color: maroon\">lot</span><span style=\"color: navy\"><b> -&gt; </b></span>immunization.lotNumber = <span style=\"color: maroon\">lot</span> <i>&quot;set lot number&quot;</i><span style=\"color: navy\">;</span>\r\n ev.icd11Code<b> as </b><span style=\"color: maroon\">icd11Code</span><b> then</b><span style=\"color: navy\"> {\r\n</span> ev.prophylaxis<b> as </b><span style=\"color: maroon\">prophylaxis</span><span style=\"color: navy\"><b> -&gt; </b></span> immunization.vaccineCode<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://hl7.org/fhir/sid/icd-11'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: maroon\">icd11Code</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: maroon\">prophylaxis</span> <i>&quot;set vaccine coding&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;Parse ICD11Code and Prophylaxis&quot;</i><span style=\"color: navy\">;</span>\r\n ev.certificateId<b> as </b><span style=\"color: maroon\">ci</span><span style=\"color: navy\"><b> -&gt; </b></span> immunization.identifier<b> as </b><span style=\"color: maroon\">identif</span><span style=\"color: navy\">, </span> identif.value = <span style=\"color: maroon\">ci</span> <i>&quot;set identifier ci&quot;</i><span style=\"color: navy\">;</span>\r\n ev.vaccine<b> as </b><span style=\"color: maroon\">mp</span><span style=\"color: navy\"><b> -&gt; </b></span> immunization.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'https://smart.who.int/ddcc/StructureDefinition/DDCCVaccineBrand'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: maroon\">mp</span> <i>&quot;set brand&quot;</i><span style=\"color: navy\">;</span>\r\n ev.facility<b> as </b><span style=\"color: maroon\">facility</span><b> then</b><span style=\"color: navy\"> {\r\n</span> facility.address<b> as </b><span style=\"color: maroon\">address</span><b> then</b><span style=\"color: navy\"> {\r\n</span> address.addressCountry<b> as </b><span style=\"color: maroon\">contry</span><span style=\"color: navy\"><b> -&gt; </b></span> immunization.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'https://smart.who.int/ddcc/StructureDefinition/DDCCCountryOfVaccination'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: maroon\">contry</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'urn:iso:std:iso:3166'</span> <i>&quot;set country&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;facility rule&quot;</i><span style=\"color: navy\">;</span>\r\n ev.effectiveUntil<b> as </b><span style=\"color: maroon\">validFrom</span><span style=\"color: navy\"><b> -&gt; </b></span> immunization.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.value = <span style=\"color: maroon\">validFrom</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'https://smart.who.int/ddcc/StructureDefinition/DDCCVaccineValidFrom'</span> <i>&quot;effectiveUntil rule&quot;</i><span style=\"color: navy\">;</span>\r\n oid<span style=\"color: navy\"><b> -&gt; </b></span> immunization.manufacturer<b> as </b><span style=\"color: maroon\">manuf</span><span style=\"color: navy\">, </span> manuf.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">oid</span><span style=\"color: navy\">)</span> <i>&quot;set manuf&quot;</i><span style=\"color: navy\">;</span>\r\n ev.facility<b> as </b><span style=\"color: maroon\">w3cFacility</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">entry</span><span style=\"color: navy\">, </span> entry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Location'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">location</span><span style=\"color: navy\">, </span> location.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">locid</span><span style=\"color: navy\">, </span> immunization.location<b> as </b><span style=\"color: maroon\">loc</span><span style=\"color: navy\">, </span> loc.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Location/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">locid</span><span style=\"color: navy\">)</span><b> then </b>ExtractLocation<span style=\"color: navy\">(</span><span style=\"color: maroon\">w3cFacility</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">location</span><span style=\"color: navy\">)</span> <i>&quot;Extracting Immunization Location&quot;</i><span style=\"color: navy\">;</span>\r\n ev<span style=\"color: navy\"><b> -&gt; </b></span>immunization.protocolApplied<b> as </b><span style=\"color: maroon\">protocolApplied</span><b> then </b>ExtractProtocolApplied<span style=\"color: navy\">(</span><span style=\"color: maroon\">ev</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">oid</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">protocolApplied</span><span style=\"color: navy\">)</span> <i>&quot;set protocol applied&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtractProtocolApplied<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">ev</span><span style=\"color: navy\"> : </span>Evidence, <b>source</b> <span style=\"color: maroon\">oid</span>, <b>target</b> <span style=\"color: maroon\">protocol</span><span style=\"color: navy\"> : </span>ProtocolApplied<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> ev.dose<b> as </b><span style=\"color: maroon\">dn</span><span style=\"color: navy\"><b> -&gt; </b></span>protocol.doseNumber = <span style=\"color: maroon\">dn</span> <i>&quot;set dose number&quot;</i><span style=\"color: navy\">;</span>\r\n ev.totalDoses<b> as </b><span style=\"color: maroon\">sd</span><span style=\"color: navy\"><b> -&gt; </b></span>protocol.seriesDoses = <span style=\"color: maroon\">sd</span> <i>&quot;set series doses&quot;</i><span style=\"color: navy\">;</span>\r\n ev<span style=\"color: navy\"><b> -&gt; </b></span> protocol.targetDisease<b> as </b><span style=\"color: maroon\">codeable</span><span style=\"color: navy\">, </span> codeable.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'840539006'</span> <i>&quot;set target disease type&quot;</i><span style=\"color: navy\">;</span>\r\n ev<span style=\"color: navy\"><b> -&gt; </b></span> protocol.authority<b> as </b><span style=\"color: maroon\">authority</span><span style=\"color: navy\">, </span> authority.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">oid</span><span style=\"color: navy\">)</span> <i>&quot;set authority&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtractPatient<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>W3CVC, <b>source</b> <span style=\"color: maroon\">pid</span>, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> pid<span style=\"color: navy\"><b> -&gt; </b></span>patient.id = <span style=\"color: maroon\">pid</span> <i>&quot;Patient ID&quot;</i><span style=\"color: navy\">;</span>\r\n src.credentialSubject<b> as </b><span style=\"color: maroon\">credentialSubject</span><span style=\"color: navy\"><b> -&gt; </b></span>patient<b> then </b>ExtractPatientFromSubj<span style=\"color: navy\">(</span><span style=\"color: maroon\">credentialSubject</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">)</span> <i>&quot;Patient Data from Subj&quot;</i><span style=\"color: navy\">;</span>\r\n src.credentialSubject<b> as </b><span style=\"color: maroon\">credSubj</span><b> then</b><span style=\"color: navy\"> {\r\n</span> src.issuanceDate<b> as </b><span style=\"color: maroon\">issuanceDate</span><b> then</b><span style=\"color: navy\"> {\r\n</span> credSubj.age<b> as </b><span style=\"color: maroon\">age</span><span style=\"color: navy\"><b> -&gt; </b></span>patient.birthDate = evaluate<span style=\"color: navy\">(</span>issuanceDate<span style=\"color: navy\">, </span>(($this - age).toString().substring(0, 4))<span style=\"color: navy\">)</span> <i>&quot;set age&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;set age issuance date&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;set cred age&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtractPatientFromSubj<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>CredentialSubject, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.name<b> as </b><span style=\"color: maroon\">patientName</span><span style=\"color: navy\"><b> -&gt; </b></span> patient.name = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'HumanName'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">humanName</span><span style=\"color: navy\">, </span> humanName.text = <span style=\"color: maroon\">patientName</span> <i>&quot;Patient Name&quot;</i><span style=\"color: navy\">;</span>\r\n src.id<b> as </b><span style=\"color: maroon\">id</span><span style=\"color: navy\"><b> -&gt; </b></span> patient.identifier<b> as </b><span style=\"color: maroon\">identif</span><span style=\"color: navy\">, </span> identif.value = <span style=\"color: maroon\">id</span> <i>&quot;set patient identifier&quot;</i><span style=\"color: navy\">;</span>\r\n src.dob<b> as </b><span style=\"color: maroon\">birthDate</span><span style=\"color: navy\"><b> -&gt; </b></span>patient.birthDate = <span style=\"color: maroon\">birthDate</span> <i>&quot;set birthDate&quot;</i><span style=\"color: navy\">;</span>\r\n src.gender<b> as </b><span style=\"color: maroon\">gender</span><span style=\"color: navy\"><b> -&gt; </b></span>patient<b> then </b>ExtractGender<span style=\"color: navy\">(</span><span style=\"color: maroon\">gender</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">)</span> <i>&quot;Extract Gender&quot;</i><span style=\"color: navy\">;</span>\r\n src.sex<b> as </b><span style=\"color: maroon\">sex</span><span style=\"color: navy\"><b> -&gt; </b></span>patient<b> then </b>ExtractGender<span style=\"color: navy\">(</span><span style=\"color: maroon\">sex</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">)</span> <i>&quot;Extract Sex&quot;</i><span style=\"color: navy\">;</span>\r\n src.address<b> as </b><span style=\"color: maroon\">w3cAddress</span><span style=\"color: navy\"><b> -&gt; </b></span>patient.address<b> as </b><span style=\"color: maroon\">fhirAddress</span><b> then </b>ExtractAddress<span style=\"color: navy\">(</span><span style=\"color: maroon\">w3cAddress</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">fhirAddress</span><span style=\"color: navy\">)</span> <i>&quot;Extracting Patient Address&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtractLocation<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">facility</span><span style=\"color: navy\"> : </span>Facility, <b>target</b> <span style=\"color: maroon\">location</span><span style=\"color: navy\"> : </span>Address<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> facility.name<b> as </b><span style=\"color: maroon\">name</span><span style=\"color: navy\"><b> -&gt; </b></span>location.name = <span style=\"color: maroon\">name</span> <i>&quot;facility name&quot;</i><span style=\"color: navy\">;</span>\r\n facility.address<b> as </b><span style=\"color: maroon\">w3cAddress</span><span style=\"color: navy\"><b> -&gt; </b></span>location.address<b> as </b><span style=\"color: maroon\">fhirAddress</span><b> then </b>ExtractAddress<span style=\"color: navy\">(</span><span style=\"color: maroon\">w3cAddress</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">fhirAddress</span><span style=\"color: navy\">)</span> <i>&quot;facility address&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtractAddress<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">w3cAddress</span><span style=\"color: navy\"> : </span>Address, <b>target</b> <span style=\"color: maroon\">fhirAddress</span><span style=\"color: navy\"> : </span>Address<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> w3cAddress.streetAddress<b> as </b><span style=\"color: maroon\">line1</span><span style=\"color: navy\"><b> -&gt; </b></span>fhirAddress.line = <span style=\"color: maroon\">line1</span> <i>&quot;Line 1&quot;</i><span style=\"color: navy\">;</span>\r\n w3cAddress.streetAddress2<b> as </b><span style=\"color: maroon\">line2</span><span style=\"color: navy\"><b> -&gt; </b></span>fhirAddress.line = <span style=\"color: maroon\">line2</span> <i>&quot;Line 2&quot;</i><span style=\"color: navy\">;</span>\r\n w3cAddress.city<b> as </b><span style=\"color: maroon\">city</span><span style=\"color: navy\"><b> -&gt; </b></span>fhirAddress.city = <span style=\"color: maroon\">city</span> <i>&quot;City&quot;</i><span style=\"color: navy\">;</span>\r\n w3cAddress.district<b> as </b><span style=\"color: maroon\">district</span><span style=\"color: navy\"><b> -&gt; </b></span>fhirAddress.district = <span style=\"color: maroon\">district</span> <i>&quot;District&quot;</i><span style=\"color: navy\">;</span>\r\n w3cAddress.postalCode<b> as </b><span style=\"color: maroon\">postal</span><span style=\"color: navy\"><b> -&gt; </b></span>fhirAddress.postalCode = <span style=\"color: maroon\">postal</span> <i>&quot;Postal&quot;</i><span style=\"color: navy\">;</span>\r\n w3cAddress.addressRegion<b> as </b><span style=\"color: maroon\">region</span><span style=\"color: navy\"><b> -&gt; </b></span>fhirAddress.state = <span style=\"color: maroon\">region</span> <i>&quot;Region&quot;</i><span style=\"color: navy\">;</span>\r\n w3cAddress.addressCountry<b> as </b><span style=\"color: maroon\">country</span><span style=\"color: navy\"><b> -&gt; </b></span>fhirAddress.country = <span style=\"color: maroon\">country</span> <i>&quot;Country&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtractGender<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">gender</span>, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> gender<b> where </b>(gender = 'M')<span style=\"color: navy\"><b> -&gt; </b></span>patient.gender = <span style=\"color: blue\">'male'</span> <i>&quot;set male&quot;</i><span style=\"color: navy\">;</span>\r\n gender<b> where </b>(gender = 'F')<span style=\"color: navy\"><b> -&gt; </b></span>patient.gender = <span style=\"color: blue\">'female'</span> <i>&quot;set female&quot;</i><span style=\"color: navy\">;</span>\r\n gender<b> where </b>(gender = 'Male')<span style=\"color: navy\"><b> -&gt; </b></span>patient.gender = <span style=\"color: blue\">'male'</span> <i>&quot;set male&quot;</i><span style=\"color: navy\">;</span>\r\n gender<b> where </b>(gender = 'Female')<span style=\"color: navy\"><b> -&gt; </b></span>patient.gender = <span style=\"color: blue\">'female'</span> <i>&quot;set female&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtractComposition<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>W3CVC, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -&gt; </b></span>composition.title = <span style=\"color: blue\">'International Certificate of Vaccination or Prophylaxis'</span> <i>&quot;Title&quot;</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -&gt; </b></span> composition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><b> then</b><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -&gt; </b></span>coding.code = <span style=\"color: blue\">'ddcc-vs'</span> <i>&quot;Category&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;set category&quot;</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -&gt; </b></span> composition.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><b> then</b><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -&gt; </b></span> coding.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'82593-5'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Immunization summary report'</span> <i>&quot;set type coding&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;set type&quot;</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -&gt; </b></span> composition.event<b> as </b><span style=\"color: maroon\">event</span><span style=\"color: navy\">, </span> event.period = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Period'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">period</span><b> then </b>ExtractPeriod<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">period</span><span style=\"color: navy\">)</span> <i>&quot;Extract Period&quot;</i><span style=\"color: navy\">;</span>\r\n src.credentialSubject<b> as </b><span style=\"color: maroon\">credentialSubject</span><span style=\"color: navy\"><b> -&gt; </b></span>composition<b> then</b><span style=\"color: navy\"> {\r\n</span> credentialSubject.refId<b> as </b><span style=\"color: maroon\">refId</span><span style=\"color: navy\"><b> -&gt; </b></span> composition.identifier<b> as </b><span style=\"color: maroon\">identif</span><span style=\"color: navy\">, </span> identif.value = <span style=\"color: maroon\">refId</span> <i>&quot;set comp identifier&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;set comp identifier parent&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtractPeriod<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>W3CVC, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Period<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.issuanceDate<b> as </b><span style=\"color: maroon\">issuanceDate</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.start = <span style=\"color: maroon\">issuanceDate</span> <i>&quot;Start issuedAt&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
  },
  "url" : "http://smart.who.int/ddcc/StructureMap/CertDIVOCtoDDCC",
  "version" : "1.0.0",
  "name" : "DIVOCtoDDCC",
  "status" : "draft",
  "date" : "2024-10-17T05:03:04+00:00",
  "publisher" : "WHO",
  "contact" : [
    {
      "name" : "WHO",
      "telecom" : [
        {
          "system" : "url",
          "value" : "http://who.int"
        }
      ]
    }
  ],
  "jurisdiction" : [
    {
      "coding" : [
        {
          "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
          "code" : "001"
        }
      ]
    }
  ],
  "structure" : [
    {
      "url" : "http://smart.who.int/ddcc/StructureDefinition/CertDIVOC",
      "mode" : "source",
      "alias" : "W3CVC"
    },
    {
      "url" : "http://hl7.org/fhir/ig/divoc/StructureDefinition/CredentialSubject",
      "mode" : "source",
      "alias" : "CredentialSubject"
    },
    {
      "url" : "http://hl7.org/fhir/ig/divoc/StructureDefinition/Proof",
      "mode" : "source",
      "alias" : "Proof"
    },
    {
      "url" : "http://hl7.org/fhir/ig/divoc/StructureDefinition/Address",
      "mode" : "source",
      "alias" : "Address"
    },
    {
      "url" : "http://hl7.org/fhir/ig/divoc/StructureDefinition/Evidence",
      "mode" : "source",
      "alias" : "Evidence"
    },
    {
      "url" : "http://hl7.org/fhir/ig/divoc/StructureDefinition/Verifier",
      "mode" : "source",
      "alias" : "Verifier"
    },
    {
      "url" : "http://hl7.org/fhir/ig/divoc/StructureDefinition/Facility",
      "mode" : "source",
      "alias" : "Facility"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
      "mode" : "target",
      "alias" : "Bundle"
    }
  ],
  "group" : [
    {
      "name" : "DIVOCtoDDCC",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "W3CVC",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "set bundle type",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "type",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "transaction"
                }
              ]
            }
          ]
        },
        {
          "name" : "Patient and Composition Create",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable"
            },
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "entry"
            },
            {
              "context" : "entry",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "comp",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Composition"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "Certificate",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable"
                }
              ],
              "dependent" : [
                {
                  "name" : "ExtractCert",
                  "variable" : [
                    "src",
                    "bundle",
                    "comp"
                  ]
                }
              ]
            },
            {
              "name" : "Composition",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable"
                }
              ],
              "dependent" : [
                {
                  "name" : "ExtractComposition",
                  "variable" : [
                    "src",
                    "comp"
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ExtractCert",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "W3CVC",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "comp",
          "type" : "Composition",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "Patient Create",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "comp",
              "contextType" : "variable"
            },
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "entry"
            },
            {
              "context" : "entry",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "patient",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Patient"
                }
              ]
            },
            {
              "contextType" : "variable",
              "variable" : "pid",
              "transform" : "uuid"
            }
          ],
          "rule" : [
            {
              "name" : "extract patient",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "patient",
                  "contextType" : "variable"
                }
              ],
              "dependent" : [
                {
                  "name" : "ExtractPatient",
                  "variable" : [
                    "src",
                    "pid",
                    "patient"
                  ]
                }
              ]
            },
            {
              "name" : "Composition.Set patient",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "comp",
                  "contextType" : "variable",
                  "element" : "subject",
                  "variable" : "subj"
                },
                {
                  "context" : "subj",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "Patient/"
                    },
                    {
                      "valueId" : "pid"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "Vaccination List",
              "source" : [
                {
                  "context" : "src",
                  "condition" : "(src.evidence.count() > 0)"
                }
              ],
              "target" : [
                {
                  "context" : "comp",
                  "contextType" : "variable",
                  "element" : "section",
                  "variable" : "section"
                }
              ],
              "rule" : [
                {
                  "name" : "add section",
                  "source" : [
                    {
                      "context" : "src"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "section",
                      "contextType" : "variable",
                      "element" : "code",
                      "variable" : "code"
                    },
                    {
                      "context" : "code",
                      "contextType" : "variable",
                      "element" : "coding",
                      "variable" : "coding"
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://loinc.org"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "11369-6"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "History of Immunization Narrative"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "Immunization Create",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "evidence",
                      "variable" : "ev"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "comp",
                      "contextType" : "variable"
                    },
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "entryImm"
                    },
                    {
                      "context" : "entryImm",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "immunization",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Immunization"
                        }
                      ]
                    },
                    {
                      "contextType" : "variable",
                      "variable" : "iid",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "entryOrg"
                    },
                    {
                      "context" : "entryOrg",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "org",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Organization"
                        }
                      ]
                    },
                    {
                      "contextType" : "variable",
                      "variable" : "oid",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "entryManuf"
                    },
                    {
                      "context" : "entryOrg",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "manuf",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Organization"
                        }
                      ]
                    },
                    {
                      "contextType" : "variable",
                      "variable" : "mid",
                      "transform" : "uuid"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "Immunization ID",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "immunization",
                          "contextType" : "variable",
                          "element" : "id",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueId" : "iid"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "Organization ID",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "org",
                          "contextType" : "variable",
                          "element" : "id",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueId" : "oid"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "Organization ID",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "manuf",
                          "contextType" : "variable",
                          "element" : "id",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueId" : "mid"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "add entry/author to section",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "section",
                          "contextType" : "variable",
                          "element" : "entry",
                          "variable" : "entry"
                        },
                        {
                          "context" : "entry",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "append",
                          "parameter" : [
                            {
                              "valueString" : "Immunization/"
                            },
                            {
                              "valueId" : "iid"
                            }
                          ]
                        },
                        {
                          "context" : "section",
                          "contextType" : "variable",
                          "element" : "author",
                          "variable" : "author"
                        },
                        {
                          "context" : "author",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "append",
                          "parameter" : [
                            {
                              "valueString" : "Organization/"
                            },
                            {
                              "valueId" : "oid"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "Composition.Set org",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "comp",
                          "contextType" : "variable",
                          "element" : "author",
                          "variable" : "author"
                        },
                        {
                          "context" : "author",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "append",
                          "parameter" : [
                            {
                              "valueString" : "Organization/"
                            },
                            {
                              "valueId" : "oid"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "Immunization.Set patient",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "immunization",
                          "contextType" : "variable",
                          "element" : "patient",
                          "variable" : "subj"
                        },
                        {
                          "context" : "subj",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "append",
                          "parameter" : [
                            {
                              "valueString" : "Patient/"
                            },
                            {
                              "valueId" : "pid"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "facility",
                      "source" : [
                        {
                          "context" : "ev",
                          "element" : "facility",
                          "variable" : "facility"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "Set Organization name",
                          "source" : [
                            {
                              "context" : "facility",
                              "element" : "name",
                              "variable" : "name"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "org",
                              "contextType" : "variable",
                              "element" : "name",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "name"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "Set Manufacturer name",
                      "source" : [
                        {
                          "context" : "ev",
                          "element" : "manufacturer",
                          "variable" : "manufName"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "manuf",
                          "contextType" : "variable",
                          "element" : "name",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueId" : "manufName"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "create practitioner",
                      "source" : [
                        {
                          "context" : "ev",
                          "element" : "verifier",
                          "variable" : "practitioner"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "set pract name",
                          "source" : [
                            {
                              "context" : "practitioner",
                              "element" : "name",
                              "variable" : "practName"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "bundle",
                              "contextType" : "variable",
                              "element" : "entry",
                              "variable" : "entry"
                            },
                            {
                              "context" : "entry",
                              "contextType" : "variable",
                              "element" : "resource",
                              "variable" : "practitioner",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "Practitioner"
                                }
                              ]
                            },
                            {
                              "context" : "practitioner",
                              "contextType" : "variable",
                              "element" : "id",
                              "variable" : "pracid",
                              "transform" : "uuid"
                            },
                            {
                              "context" : "practitioner",
                              "contextType" : "variable",
                              "element" : "name",
                              "variable" : "humanName",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "HumanName"
                                }
                              ]
                            },
                            {
                              "context" : "humanName",
                              "contextType" : "variable",
                              "element" : "text",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "practName"
                                }
                              ]
                            },
                            {
                              "context" : "immunization",
                              "contextType" : "variable",
                              "element" : "performer",
                              "variable" : "performer"
                            },
                            {
                              "context" : "performer",
                              "contextType" : "variable",
                              "element" : "actor",
                              "variable" : "actor"
                            },
                            {
                              "context" : "actor",
                              "contextType" : "variable",
                              "element" : "reference",
                              "transform" : "append",
                              "parameter" : [
                                {
                                  "valueString" : "Practitioner/"
                                },
                                {
                                  "valueId" : "pracid"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "extract vaccine info",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "bundle",
                          "contextType" : "variable"
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "ExtractVaccine",
                          "variable" : [
                            "ev",
                            "oid",
                            "mid",
                            "immunization",
                            "bundle"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ExtractVaccine",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "ev",
          "type" : "Evidence",
          "mode" : "source"
        },
        {
          "name" : "oid",
          "mode" : "source"
        },
        {
          "name" : "mid",
          "mode" : "source"
        },
        {
          "name" : "immunization",
          "type" : "Immunization",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "set occurrence date",
          "source" : [
            {
              "context" : "ev",
              "element" : "date",
              "variable" : "dt"
            }
          ],
          "target" : [
            {
              "context" : "immunization",
              "contextType" : "variable",
              "element" : "occurrence",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "dt"
                }
              ]
            }
          ]
        },
        {
          "name" : "set lot number",
          "source" : [
            {
              "context" : "ev",
              "element" : "batch",
              "variable" : "lot"
            }
          ],
          "target" : [
            {
              "context" : "immunization",
              "contextType" : "variable",
              "element" : "lotNumber",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "lot"
                }
              ]
            }
          ]
        },
        {
          "name" : "Parse ICD11Code and Prophylaxis",
          "source" : [
            {
              "context" : "ev",
              "element" : "icd11Code",
              "variable" : "icd11Code"
            }
          ],
          "rule" : [
            {
              "name" : "set vaccine coding",
              "source" : [
                {
                  "context" : "ev",
                  "element" : "prophylaxis",
                  "variable" : "prophylaxis"
                }
              ],
              "target" : [
                {
                  "context" : "immunization",
                  "contextType" : "variable",
                  "element" : "vaccineCode",
                  "variable" : "type"
                },
                {
                  "context" : "type",
                  "contextType" : "variable",
                  "element" : "coding",
                  "variable" : "coding"
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "http://hl7.org/fhir/sid/icd-11"
                    }
                  ]
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueId" : "icd11Code"
                    }
                  ]
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "display",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueId" : "prophylaxis"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "set identifier ci",
          "source" : [
            {
              "context" : "ev",
              "element" : "certificateId",
              "variable" : "ci"
            }
          ],
          "target" : [
            {
              "context" : "immunization",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "identif"
            },
            {
              "context" : "identif",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "ci"
                }
              ]
            }
          ]
        },
        {
          "name" : "set brand",
          "source" : [
            {
              "context" : "ev",
              "element" : "vaccine",
              "variable" : "mp"
            }
          ],
          "target" : [
            {
              "context" : "immunization",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "ext"
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "coding",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Coding"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "https://smart.who.int/ddcc/StructureDefinition/DDCCVaccineBrand"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "display",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "mp"
                }
              ]
            }
          ]
        },
        {
          "name" : "ev.facility rule",
          "source" : [
            {
              "context" : "ev",
              "element" : "facility",
              "variable" : "facility"
            }
          ],
          "rule" : [
            {
              "name" : "ev.facility.address",
              "source" : [
                {
                  "context" : "facility",
                  "element" : "address",
                  "variable" : "address"
                }
              ],
              "rule" : [
                {
                  "name" : "set country",
                  "source" : [
                    {
                      "context" : "address",
                      "element" : "addressCountry",
                      "variable" : "contry"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "immunization",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "ext"
                    },
                    {
                      "context" : "ext",
                      "contextType" : "variable",
                      "element" : "value",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    },
                    {
                      "context" : "ext",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "https://smart.who.int/ddcc/StructureDefinition/DDCCCountryOfVaccination"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "contry"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "urn:iso:std:iso:3166"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "ev.effectiveUntil rule",
          "source" : [
            {
              "context" : "ev",
              "element" : "effectiveUntil",
              "variable" : "validFrom"
            }
          ],
          "target" : [
            {
              "context" : "immunization",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "ext"
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "validFrom"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "https://smart.who.int/ddcc/StructureDefinition/DDCCVaccineValidFrom"
                }
              ]
            }
          ]
        },
        {
          "name" : "set manuf",
          "source" : [
            {
              "context" : "oid"
            }
          ],
          "target" : [
            {
              "context" : "immunization",
              "contextType" : "variable",
              "element" : "manufacturer",
              "variable" : "manuf"
            },
            {
              "context" : "manuf",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "Organization/"
                },
                {
                  "valueId" : "oid"
                }
              ]
            }
          ]
        },
        {
          "name" : "Extracting Immunization Location",
          "source" : [
            {
              "context" : "ev",
              "element" : "facility",
              "variable" : "w3cFacility"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "entry"
            },
            {
              "context" : "entry",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "location",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Location"
                }
              ]
            },
            {
              "context" : "location",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "locid",
              "transform" : "uuid"
            },
            {
              "context" : "immunization",
              "contextType" : "variable",
              "element" : "location",
              "variable" : "loc"
            },
            {
              "context" : "loc",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "Location/"
                },
                {
                  "valueId" : "locid"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "ExtractLocation",
              "variable" : [
                "w3cFacility",
                "location"
              ]
            }
          ]
        },
        {
          "name" : "set protocol applied",
          "source" : [
            {
              "context" : "ev"
            }
          ],
          "target" : [
            {
              "context" : "immunization",
              "contextType" : "variable",
              "element" : "protocolApplied",
              "variable" : "protocolApplied"
            }
          ],
          "dependent" : [
            {
              "name" : "ExtractProtocolApplied",
              "variable" : [
                "ev",
                "oid",
                "protocolApplied"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ExtractProtocolApplied",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "ev",
          "type" : "Evidence",
          "mode" : "source"
        },
        {
          "name" : "oid",
          "mode" : "source"
        },
        {
          "name" : "protocol",
          "type" : "ProtocolApplied",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "set dose number",
          "source" : [
            {
              "context" : "ev",
              "element" : "dose",
              "variable" : "dn"
            }
          ],
          "target" : [
            {
              "context" : "protocol",
              "contextType" : "variable",
              "element" : "doseNumber",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "dn"
                }
              ]
            }
          ]
        },
        {
          "name" : "set series doses",
          "source" : [
            {
              "context" : "ev",
              "element" : "totalDoses",
              "variable" : "sd"
            }
          ],
          "target" : [
            {
              "context" : "protocol",
              "contextType" : "variable",
              "element" : "seriesDoses",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "sd"
                }
              ]
            }
          ]
        },
        {
          "name" : "set target disease type",
          "source" : [
            {
              "context" : "ev"
            }
          ],
          "target" : [
            {
              "context" : "protocol",
              "contextType" : "variable",
              "element" : "targetDisease",
              "variable" : "codeable"
            },
            {
              "context" : "codeable",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://snomed.info/sct"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "840539006"
                }
              ]
            }
          ]
        },
        {
          "name" : "set authority",
          "source" : [
            {
              "context" : "ev"
            }
          ],
          "target" : [
            {
              "context" : "protocol",
              "contextType" : "variable",
              "element" : "authority",
              "variable" : "authority"
            },
            {
              "context" : "authority",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "Organization/"
                },
                {
                  "valueId" : "oid"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ExtractPatient",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "W3CVC",
          "mode" : "source"
        },
        {
          "name" : "pid",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "Patient ID",
          "source" : [
            {
              "context" : "pid"
            }
          ],
          "target" : [
            {
              "context" : "patient",
              "contextType" : "variable",
              "element" : "id",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "pid"
                }
              ]
            }
          ]
        },
        {
          "name" : "Patient Data from Subj",
          "source" : [
            {
              "context" : "src",
              "element" : "credentialSubject",
              "variable" : "credentialSubject"
            }
          ],
          "target" : [
            {
              "context" : "patient",
              "contextType" : "variable"
            }
          ],
          "dependent" : [
            {
              "name" : "ExtractPatientFromSubj",
              "variable" : [
                "credentialSubject",
                "patient"
              ]
            }
          ]
        },
        {
          "name" : "set cred age",
          "source" : [
            {
              "context" : "src",
              "element" : "credentialSubject",
              "variable" : "credSubj"
            }
          ],
          "rule" : [
            {
              "name" : "set age issuance date",
              "source" : [
                {
                  "context" : "src",
                  "element" : "issuanceDate",
                  "variable" : "issuanceDate"
                }
              ],
              "rule" : [
                {
                  "name" : "set age",
                  "source" : [
                    {
                      "context" : "credSubj",
                      "element" : "age",
                      "variable" : "age"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "patient",
                      "contextType" : "variable",
                      "element" : "birthDate",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueId" : "issuanceDate"
                        },
                        {
                          "valueString" : "(($this - age).toString().substring(0, 4))"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ExtractPatientFromSubj",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "CredentialSubject",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "Patient Name",
          "source" : [
            {
              "context" : "src",
              "element" : "name",
              "variable" : "patientName"
            }
          ],
          "target" : [
            {
              "context" : "patient",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "humanName",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "HumanName"
                }
              ]
            },
            {
              "context" : "humanName",
              "contextType" : "variable",
              "element" : "text",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "patientName"
                }
              ]
            }
          ]
        },
        {
          "name" : "set patient identifier",
          "source" : [
            {
              "context" : "src",
              "element" : "id",
              "variable" : "id"
            }
          ],
          "target" : [
            {
              "context" : "patient",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "identif"
            },
            {
              "context" : "identif",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "id"
                }
              ]
            }
          ]
        },
        {
          "name" : "set birthDate",
          "source" : [
            {
              "context" : "src",
              "element" : "dob",
              "variable" : "birthDate"
            }
          ],
          "target" : [
            {
              "context" : "patient",
              "contextType" : "variable",
              "element" : "birthDate",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "birthDate"
                }
              ]
            }
          ]
        },
        {
          "name" : "Extract Gender",
          "source" : [
            {
              "context" : "src",
              "element" : "gender",
              "variable" : "gender"
            }
          ],
          "target" : [
            {
              "context" : "patient",
              "contextType" : "variable"
            }
          ],
          "dependent" : [
            {
              "name" : "ExtractGender",
              "variable" : [
                "gender",
                "patient"
              ]
            }
          ]
        },
        {
          "name" : "Extract Sex",
          "source" : [
            {
              "context" : "src",
              "element" : "sex",
              "variable" : "sex"
            }
          ],
          "target" : [
            {
              "context" : "patient",
              "contextType" : "variable"
            }
          ],
          "dependent" : [
            {
              "name" : "ExtractGender",
              "variable" : [
                "sex",
                "patient"
              ]
            }
          ]
        },
        {
          "name" : "Extracting Patient Address",
          "source" : [
            {
              "context" : "src",
              "element" : "address",
              "variable" : "w3cAddress"
            }
          ],
          "target" : [
            {
              "context" : "patient",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "fhirAddress"
            }
          ],
          "dependent" : [
            {
              "name" : "ExtractAddress",
              "variable" : [
                "w3cAddress",
                "fhirAddress"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ExtractLocation",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "facility",
          "type" : "Facility",
          "mode" : "source"
        },
        {
          "name" : "location",
          "type" : "Address",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "facility name",
          "source" : [
            {
              "context" : "facility",
              "element" : "name",
              "variable" : "name"
            }
          ],
          "target" : [
            {
              "context" : "location",
              "contextType" : "variable",
              "element" : "name",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "name"
                }
              ]
            }
          ]
        },
        {
          "name" : "facility address",
          "source" : [
            {
              "context" : "facility",
              "element" : "address",
              "variable" : "w3cAddress"
            }
          ],
          "target" : [
            {
              "context" : "location",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "fhirAddress"
            }
          ],
          "dependent" : [
            {
              "name" : "ExtractAddress",
              "variable" : [
                "w3cAddress",
                "fhirAddress"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ExtractAddress",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "w3cAddress",
          "type" : "Address",
          "mode" : "source"
        },
        {
          "name" : "fhirAddress",
          "type" : "Address",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "Line 1",
          "source" : [
            {
              "context" : "w3cAddress",
              "element" : "streetAddress",
              "variable" : "line1"
            }
          ],
          "target" : [
            {
              "context" : "fhirAddress",
              "contextType" : "variable",
              "element" : "line",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "line1"
                }
              ]
            }
          ]
        },
        {
          "name" : "Line 2",
          "source" : [
            {
              "context" : "w3cAddress",
              "element" : "streetAddress2",
              "variable" : "line2"
            }
          ],
          "target" : [
            {
              "context" : "fhirAddress",
              "contextType" : "variable",
              "element" : "line",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "line2"
                }
              ]
            }
          ]
        },
        {
          "name" : "City",
          "source" : [
            {
              "context" : "w3cAddress",
              "element" : "city",
              "variable" : "city"
            }
          ],
          "target" : [
            {
              "context" : "fhirAddress",
              "contextType" : "variable",
              "element" : "city",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "city"
                }
              ]
            }
          ]
        },
        {
          "name" : "District",
          "source" : [
            {
              "context" : "w3cAddress",
              "element" : "district",
              "variable" : "district"
            }
          ],
          "target" : [
            {
              "context" : "fhirAddress",
              "contextType" : "variable",
              "element" : "district",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "district"
                }
              ]
            }
          ]
        },
        {
          "name" : "Postal",
          "source" : [
            {
              "context" : "w3cAddress",
              "element" : "postalCode",
              "variable" : "postal"
            }
          ],
          "target" : [
            {
              "context" : "fhirAddress",
              "contextType" : "variable",
              "element" : "postalCode",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "postal"
                }
              ]
            }
          ]
        },
        {
          "name" : "Region",
          "source" : [
            {
              "context" : "w3cAddress",
              "element" : "addressRegion",
              "variable" : "region"
            }
          ],
          "target" : [
            {
              "context" : "fhirAddress",
              "contextType" : "variable",
              "element" : "state",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "region"
                }
              ]
            }
          ]
        },
        {
          "name" : "Country",
          "source" : [
            {
              "context" : "w3cAddress",
              "element" : "addressCountry",
              "variable" : "country"
            }
          ],
          "target" : [
            {
              "context" : "fhirAddress",
              "contextType" : "variable",
              "element" : "country",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "country"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ExtractGender",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "gender",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "set male",
          "source" : [
            {
              "context" : "gender",
              "condition" : "(gender = 'M')"
            }
          ],
          "target" : [
            {
              "context" : "patient",
              "contextType" : "variable",
              "element" : "gender",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "male"
                }
              ]
            }
          ]
        },
        {
          "name" : "set female",
          "source" : [
            {
              "context" : "gender",
              "condition" : "(gender = 'F')"
            }
          ],
          "target" : [
            {
              "context" : "patient",
              "contextType" : "variable",
              "element" : "gender",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "female"
                }
              ]
            }
          ]
        },
        {
          "name" : "set male",
          "source" : [
            {
              "context" : "gender",
              "condition" : "(gender = 'Male')"
            }
          ],
          "target" : [
            {
              "context" : "patient",
              "contextType" : "variable",
              "element" : "gender",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "male"
                }
              ]
            }
          ]
        },
        {
          "name" : "set female",
          "source" : [
            {
              "context" : "gender",
              "condition" : "(gender = 'Female')"
            }
          ],
          "target" : [
            {
              "context" : "patient",
              "contextType" : "variable",
              "element" : "gender",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "female"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ExtractComposition",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "W3CVC",
          "mode" : "source"
        },
        {
          "name" : "composition",
          "type" : "Composition",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "Title",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "title",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "International Certificate of Vaccination or Prophylaxis"
                }
              ]
            }
          ]
        },
        {
          "name" : "set category",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "category",
              "variable" : "category"
            },
            {
              "context" : "category",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            }
          ],
          "rule" : [
            {
              "name" : "Category",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "ddcc-vs"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "set type",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "type",
              "variable" : "type"
            },
            {
              "context" : "type",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            }
          ],
          "rule" : [
            {
              "name" : "set type coding",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "http://loinc.org"
                    }
                  ]
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "82593-5"
                    }
                  ]
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "display",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "Immunization summary report"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "Extract Period",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "event",
              "variable" : "event"
            },
            {
              "context" : "event",
              "contextType" : "variable",
              "element" : "period",
              "variable" : "period",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Period"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "ExtractPeriod",
              "variable" : [
                "src",
                "period"
              ]
            }
          ]
        },
        {
          "name" : "set comp identifier parent",
          "source" : [
            {
              "context" : "src",
              "element" : "credentialSubject",
              "variable" : "credentialSubject"
            }
          ],
          "target" : [
            {
              "context" : "composition",
              "contextType" : "variable"
            }
          ],
          "rule" : [
            {
              "name" : "set comp identifier",
              "source" : [
                {
                  "context" : "credentialSubject",
                  "element" : "refId",
                  "variable" : "refId"
                }
              ],
              "target" : [
                {
                  "context" : "composition",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identif"
                },
                {
                  "context" : "identif",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueId" : "refId"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ExtractPeriod",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "W3CVC",
          "mode" : "source"
        },
        {
          "name" : "tgt",
          "type" : "Period",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "Start issuedAt",
          "source" : [
            {
              "context" : "src",
              "element" : "issuanceDate",
              "variable" : "issuanceDate"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "start",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "issuanceDate"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

XIG built as of ??metadata-date??. Found ??metadata-resources?? resources in ??metadata-packages?? packages.